<extend name="Public/base"/>
<block name="content">
<h3 class="col-md-12">网站设置</h3>
<div class="row">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-heading">邮件配置</div>		
			<div class="panel-body">
				<form class="form-horizontal" id="email-form" action="<{:U('mod')}>"  method="post">						
							<div class="form-group">											
								<label class="col-sm-2 control-label">邮件发送方式</label>							
								<div class="col-sm-4">
									<select id="form_email_sendtype" class="form-control" name="email_sendtype">
				      		      		<option <neq name="config['email_sendtype']" value="mail">selected="selected"</neq> value="smtp">远程smtp</option>
				      		      		<option value="mail" <eq name="config['email_sendtype']" value="mail">selected="selected"</eq> value="smtp">本地mail</option>
				      		      	</select>
								</div>							
							</div>							
							
							<div class="form-group">											
								<label class="col-sm-2 control-label">SMTP地址</label>	
								<div class="col-sm-4">
									<input type="text" class="form-control" value="<{$config['email_host']|default='smtp.admin.com'}>" name="email_host">
									<span class="help-block">发送邮箱的smtp地址。如: smtp.gmail.com或smtp.qq.com</span>
								</div>
								
							</div>
							
							<div class="form-group">											
								<label class="col-sm-2 control-label">是否启用SSL连接</label>	
								<div class="col-sm-6">            	
      	        					<label><input type="radio" <neq name="config['email_ssl']" value="1">checked="checked"</neq>  value="0" name="email_ssl">否 </label>            		
      	        					<label><input type="radio" <eq name="config['email_ssl']" value="1">checked="checked"</eq> value="1" name="email_ssl">是 </label>            		
 									<span class="help-block">此选项需要服务器环境支持SSL（如果使用Gmail或QQ邮箱，请选择是）</span>
              					</div>											
							</div>
							
							<div class="form-group">											
								<label class="col-sm-2 control-label">端口</label>	
								<div class="col-sm-8">
									<input type="text" class="form-control" style="width:60px;" value="<{$config['email_port']|default='25'}>" name="email_port">
									<p class="help-block">smtp的端口默认为25。具体请参看各STMP服务商的设置说明 （如果使用Gmail或QQ邮箱，请将端口设为465）</p>
								</div>
							</div>
							
							<div class="form-group">											
								<label class="col-sm-2 control-label">服务器用户名</label>	
								<div class="col-sm-4">
									<input type="text" class="form-control" value="<{$config['email_account']|default='admin@admin.com'}>" name="email_account">
									<p class="help-block">邮箱地址请输入完整地址email@email.com格式</p>
								</div>									
							</div> 
	                		<div class="form-group">											
								<label class="col-sm-2 control-label">邮箱密码</label>							
								<div class="col-sm-3">
									<input type="password" class="form-control"  value="<{$config['email_password']|default='admin'}>" name="email_password">
								</div>							
							</div>							
							
							<div class="form-group">											
								<label class="col-sm-2 control-label">发送者名称</label>	
								<div class="col-sm-3">
									<input type="text" class="form-control" value="<{$config['email_sender_name']|default='JYmusic音乐程序'}>" name="email_sender_name">
								</div>
							</div>
							
							<div class="form-group">											
								<label class="col-sm-2 control-label">发送者邮箱</label>	
								<div class="col-sm-3">
									<input type="text" class="form-control" value="<{$config['email_sender_email']|default='admin@admin.com'}>" name="email_sender_email">
									<p class="help-block">邮件中显示的发送者邮箱</p>
								</div>										
							</div>
							
							<div class="form-group">											
								<label class="col-sm-2 control-label">测试邮邮箱</label>	
								<div class="col-sm-3">
									<input type="text" class="form-control" value="" name="sendto_email">
									<p class="help-block"><a href="javascript:;" id="send-email">点击测试发送</a></p>
								</div>
							</div>
									
							<div class="form-group">      		
			            		<div class="col-sm-4 col-sm-offset-2">
			                		<button class="btn btn-default" type="button" onclick="javascript:history.back(-1);return false;">取消</button>
			                		<button class="btn btn-primary ajax-post" target-form="form-horizontal" type="submit">保存</button>
			            		</div>
		        			</div>
				</form>	
			</div>		
		</div>
	</div>
</div>
</block>
<block name="script">
<script type="text/javascript">
	//导航高亮
	highlight_subnav("<{:U('Email/index')}>");
	$('#send-email').click(function () {
		var self = $(this),
		query = $('#email-form').serialize();
		
		self.text('正在发送...');
		$.post('<{:U('test')}>',query).success(function(data){
			if(data.status){
				topAlert(data.info,'success');
			}else{
				topAlert(data.info);				
			}
			self.text('点击测试发送');
		});
	})
</script>
</block>	


